
function loadData() {
    let pagenum = 0;
    let pagesize =300;
    let url = 'http://jx.xuzhixiang.top/ap/api/allproductlist.php';
    let uid = localStorage.getItem('uid');
    let token = localStorage.getItem('token');
    axios.get(url, {
        params: {
            pagenum,
            pagesize,
            uid
        }
    }).then(res => {
        // console.log(res.data.data);             
        let arr = res.data.data;
        let html ='';
      
        arr.forEach(obj => {
            html += `   <li class="today_new_product_list_li">
            <div class="img_box">
                <a href="" class="img_box_href">
                    <img src="${obj.pimg}" alt="" class="car_img">
                    <div class="img_ms">${obj.pdesc}</div>
                </a>
                <div class="deals_tage">
                    <span></span>
                </div>
                <div class="add_car_box">
                    <a href="" class="add_car" data-id="${obj.pid}">加入购物车
                    </a>
                    <ul class="add_car_div">
                        <li><a href="">肤色(4.0)+M(建议100斤以下)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+M(建议100斤以下)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                        <li><a href="">肤色(4.0)+L(建议100斤—120斤)</a></li>
                      
                    </ul>
                </div>
            </div>
            <a href="xq.html?id=${obj.pid}">
                <div class="today_new_datils">
                    <p class="title">${obj.pname}</p>
                    <div class="intro_box">
                        <div class="price_box">
                          
                            <span class="pnum">￥${obj.pprice}</span>
                        </div>
                        <div class="numtimer_box global_numtimer_box"></div>
                    </div>
                </div>
            </a>
        </li>`
        })

        let list = document.querySelector('.today_new_product_list_ul');
        list.innerHTML = html;

    })
}
loadData()


// 发布商品

//  function publishProduct() {
//         let ipts = document.querySelectorAll('#send input')
//         ipts[4].onclick = function () {
//             let pname = ipts[0].value
//             let pprice = ipts[1].value
//             let pimg = ipts[2].value
//             let pdesc = ipts[3].value
//             let uid = localStorage.getItem('uid')

//             let pAPI = 'http://jx.xuzhixiang.top/ap/api/goods/goods-add.php'
//             axios.get(pAPI, { params: { pname, pprice, pimg, pdesc, uid } })
//                 .then(res => {
//                     console.log(res.data);                  
        
//                 })
//         }
//     }

//     publishProduct()

